package com.dqhl.smartstable.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dqhl.smartstable.R;
import com.dqhl.smartstable.activity.CarInfoActivity;
import com.dqhl.smartstable.activity.ContactsActivity;
import com.dqhl.smartstable.activity.OperationLogActivity;
import com.dqhl.smartstable.activity.AlarmLogActivity;
import com.dqhl.smartstable.activity.PersonalInfoActivity;
import com.dqhl.smartstable.activity.SettingActivity;
import com.dqhl.smartstable.base.BaseFragment;

/**
 * Created by mac on 16/10/13.
 * 个人
 */
public class PersonalFragment extends BaseFragment implements View.OnClickListener {

    private TextView tv_top_center;
    private ImageView iv_setting;

    private LinearLayout ll_personal_info; //个人信息
    private LinearLayout ll_car_info; //车辆信息
    private LinearLayout ll_contacts; //紧急联系人
    private LinearLayout ll_transport_order; //运输订单
    private LinearLayout ll_repair_order; //报修订单
    private LinearLayout ll_alarm_log; //警报日志
    private LinearLayout ll_operation_log; //操作日志

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_personal, container, false);

        initView(view);

        return view;
    }

    private void initView(View view) {
        tv_top_center = (TextView) view.findViewById(R.id.tv_top_center);
        tv_top_center.setText("我 的");
        iv_setting = (ImageView) view.findViewById(R.id.iv_setting);

        ll_personal_info = (LinearLayout) view.findViewById(R.id.ll_personal_info);
        ll_car_info = (LinearLayout) view.findViewById(R.id.ll_car_info);
        ll_contacts = (LinearLayout) view.findViewById(R.id.ll_contacts);
        ll_transport_order = (LinearLayout) view.findViewById(R.id.ll_transport_order);
        ll_repair_order = (LinearLayout) view.findViewById(R.id.ll_repair_order);
        ll_alarm_log = (LinearLayout) view.findViewById(R.id.ll_alarm_log);
        ll_operation_log = (LinearLayout) view.findViewById(R.id.ll_operation_log);

        ll_personal_info.setOnClickListener(this);
        ll_car_info.setOnClickListener(this);
        ll_contacts.setOnClickListener(this);
        ll_transport_order.setOnClickListener(this);
        ll_repair_order.setOnClickListener(this);
        ll_alarm_log.setOnClickListener(this);
        ll_operation_log.setOnClickListener(this);

        iv_setting.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_setting: //设置
                overlay(SettingActivity.class);
                break;
            case R.id.ll_personal_info: //个人信息
                overlay(PersonalInfoActivity.class);
                break;
            case R.id.ll_car_info: //车辆信息
//                overlay(CarInfoActivity.class);
                break;
            case R.id.ll_contacts: //紧急联系人
                overlay(ContactsActivity.class);
                break;
            case R.id.ll_transport_order://运输订单
                toast("ll_transport_order");
                break;
            case R.id.ll_repair_order: //报修订单
                toast("ll_repair_order");
                break;
            case R.id.ll_alarm_log: //警报日志
                overlay(AlarmLogActivity.class);
                break;
            case R.id.ll_operation_log://操作日志
                overlay(OperationLogActivity.class);
                break;
        }
    }
}
